﻿using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NeonLampTest.Common
{
    public class LeftNode : SurroundNodeBase
    {
        public override bool IsNext => Displacement >= Height;
        public override void Default()
        {
            Displacement = 1;
            Y = Height;
            StartColor = EndColor = DefaultColor;
        }
        public override void Change()
        {
            Y -= Step;
            if (Y < 0) Y = 0;
            X = 0;
            Displacement += Step;
            if (Displacement > Height) Displacement = Height;
            ChangeEndColor();
        }

        public override void Draw(Graphics g)
        {
            Rectangle rectangle = new Rectangle(X, Y, SurroundWidth, Displacement);
            using (LinearGradientBrush bh = new LinearGradientBrush(rectangle, StartColor, EndColor, LinearGradientMode.Vertical))
            {
                g.FillRectangle(bh, rectangle);
            }
        }
    }
}
